package org.dtrd.modules.service.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.service.entity.bean.PackagePatientRelation;

import javax.persistence.Table;
import java.util.Date;


/**
 * <p>
 * 患者和服务包关系表
 * </p>
 *
 * @author QR
 * @since 2021-12-16
 */
@Getter
@Setter
@TableName("dtrd_rl_package_patient")
public class DtrdRlPackagePatient {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 患者id
     */
    @TableField("patient_id")
    private Integer patientId;

    /**
     * 服务包id
     */
    @TableField("package_id")
    private Integer packageId;

    /**
     * 服务包状态, 0-待服务, 1-服务中
     */
    @TableField("status")
    private Integer status;

    /**
     * 服务成效
     */
    @TableField("manage_effect")
    private String manageEffect;

    /**
     * 服务结束总结
     */
    @TableField("service_end_summary")
    private String serviceEndSummary;

    /**
     * 设置服务包的时间
     */
    @TableField("start_time")
    private Date startTime;

    /**
     * 服务包结束时间, 开始时间+服务包周期
     */
    @TableField("end_time")
    private Date endTime;

    /**
     * 服务周期 1-天 2-月 3-年 4-周
     */
    @TableField("period_unit")
    private Integer periodUnit;

    @TableField("finish_time")
    private Date finishTime;

    /**
     * 机构编码
     */
    @TableField("org_code")
    private String orgCode;

    /**
     * 执行人ID
     */
    @TableField("executor_id")
    private String executorId;

    /**
     * 执行人名称
     */
    @TableField("executor_name")
    private String executorName;

    /**
     * 主治医生
     */
    @TableField("doctor")
    private String doctor;

    /**
     * 健康管理师
     */
    @TableField("health_manager")
    private String healthManager;

    /**
     * 心理咨询师
     */
    @TableField("psychological_counselor")
    private String psychologicalCounselor;

    /**
     * 运动康复师
     */
    @TableField("sport_manager")
    private String sportManager;

    /**
     * 营养师
     */
    @TableField("dietician")
    private String dietician;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdRlPackagePatient() {
    }

    public DtrdRlPackagePatient(Integer patientId, Integer packageId, Date startTime, Date endTime) {
        this.patientId = patientId;
        this.packageId = packageId;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    public DtrdRlPackagePatient init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdRlPackagePatient parseFromDto(PackagePatientRelation dto) {
        patientId = dto.getPatientId();
        packageId = dto.getPackageId();
        return this;
    }


}
